<template>
  <div>
    <ul>
      <li v-for="(item, index) in navs" :key="index" :class="{ active: index === isShow }" @click="toggle(index)">
        {{ item }}
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data () {
    return {
      navs: ['大学起点', '中专起点', '高中起点'],
      isShow: 0
    }
  },

  created () {

  },

  methods: {
    toggle (index) {
      this.isShow = index
    }
  }
}
</script>

<style scoped lang='less'>
ul {
  list-style: none;
  border-radius: 10px;
  width: 300px;
  overflow: hidden;
  padding: 0;
  li {
    float: left;
    width: 100px;
    height: 40px;
    background-color: #ccc;
    color: #fff;
    text-align: center;
    line-height: 40px;
    cursor: pointer;
  }
  .active {
    background-color: blue;
  }
}
</style>
